package cn.bob.feign;

import cn.bob.domain.User;
import feign.hystrix.FallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;

/**
 * @author bob
 * @data 2022/11/9-14:56
 */
@Component
public class PayfallbackFactory implements FallbackFactory<UserServer> {
    @Override
    public UserServer create(Throwable throwable) {
        return new UserServer() {
            @Override
            public User getUser(Long id) {
                return new User(-1L,"熔断了",23,"触发了熔断机制！！");
            }
        };
    }
}
